package string_question.miashi.test1;

import java.util.Scanner;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/7/5 14:14
 */
public class Solution1 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        int count = 0, max = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == '(') {
                count++;
            } else {
                count--;
            }
            max = Math.max(count, max);
        }
        System.out.println(max);
    }
}
